package comframe.jdbc.sql.convert;

import java.math.BigDecimal;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * 通过反射获取字段值 字段方法必须符合javaBean规则
 * 
 * @author ray
 * 
 */
public class TypeConvertUtil {
 private static Logger  logger = LoggerFactory.getLogger(TypeConvertUtil.class);
	public static Float StringToFloat(String s) {
		try {
			if (s != null)
				return Float.valueOf(s);
		} catch (NumberFormatException e) {
			logger.error("String to float 错误 ：[" + s + "]");
		}
		return 0f;
	}

	public static Integer StringToInteger(String s) {
		if (s != null)
			return Integer.valueOf(s);
		return 0;
	}

	public static Object StringToBigDecimal(String s) {
		return BigDecimal.valueOf(Double.parseDouble(s));
	}
}
